<template>
  <el-row :gutter="10" type="flex" class="panel-group">
    <el-col :span="8"  class="card-panel-col">
      <div class="card-panel" style="background: deepskyblue;"  @click="handleSetLineChartData('newVisitis')">
        	<div style="padding:10px;height:100%;box-sizing:border-box;display: flex;flex-direction: column;">
        		<div style="height:20px;line-height: 20px;">
        			<span style="font-size: 20px;color: white;">上报待处理</span>
        			<span style="font-size: 12px;color: #f6f6f6;">(较上日)</span>
        		</div>
        		<div style="flex:1;display: flex;justify-content: space-between;align-items: center;">
        			<span style="font-size: 20px;color: white;">{{todayDisputeCount}}
        				<span style="font-size: 12px;color: #f6f6f6;">件</span>
        			</span>
        			<span style="font-size: 20px;color: white;">{{disputePercent}}%</span>
        		</div>
        		<div style="height:20px;border-top: 1px solid #fff;line-height: 20px;">
        			<span style="font-size: 12px;color: #f6f6f6;">
        					已处理{{finishDisputeCount}}件
        			</span>
        		</div>
        	</div>
      </div>
    </el-col>
    <!-- <el-col :span="1" class="card-panel-col"></el-col> -->
    <el-col :span="8" class="card-panel-col">
      <div class="card-panel" style="background: limegreen;"  @click="handleSetLineChartData('newVisitis')">
        	<div style="padding:10px;height:100%;box-sizing:border-box;display: flex;flex-direction: column;">
        		<div style="height:20px;line-height: 20px;">
        			<span style="font-size: 20px;color: white;">咨询待处理</span>
        			<span style="font-size: 12px;color: #f6f6f6;">(较上日)</span>
        		</div>
        		<div style="flex:1;display: flex;justify-content: space-between;align-items: center;">
        			<span style="font-size: 20px;color: white;">{{this.todayQuestionCount}}
        				<span style="font-size: 12px;color: #f6f6f6;">件</span>
        			</span>
        			<span style="font-size: 20px;color: white;">{{this.questionPercent}}%</span>
        		</div>
        		<div style="height:20px;border-top: 1px solid #fff;line-height: 20px;">
        			<span style="font-size: 12px;color: #f6f6f6;">
        					已处理{{this.finishQuestionCount}}件
        			</span>
        		</div>
        	</div>
      </div>
    </el-col>
    <!-- <el-col :span="1" class="card-panel-col"></el-col> -->
    <el-col :span="8" class="card-panel-col">
      <div class="card-panel" style="background: orange;"  @click="handleSetLineChartData('newVisitis')">
        	<div style="padding:10px;height:100%;box-sizing:border-box;display: flex;flex-direction: column;">
        		<div style="height:20px;line-height: 20px;">
        			<span style="font-size: 20px;color: white;">任务待分配</span>
        			<span style="font-size: 12px;color: #f6f6f6;">(较上日)</span>
        		</div>
        		<div style="flex:1;display: flex;justify-content: space-between;align-items: center;">
        			<span style="font-size: 20px;color: white;">{{this.totalWaitNumer}}
        				<span style="font-size: 12px;color: #f6f6f6;">件</span>
        			</span>
        			<span style="font-size: 20px;color: white;">{{this.dfpZzl}}%</span>
        		</div>
        		<div style="height:20px;border-top: 1px solid #fff;line-height: 20px;">
        			<span style="font-size: 12px;color: #f6f6f6;">
        					已处理{{this.dfPZcount}}件
        			</span>
        		</div>
        	</div>
      </div>
    </el-col>
    <!--<el-col :xs="7" :sm="7" :lg="7" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('messages')">
        <div class="card-panel-icon-wrapper icon-message">
          <svg-icon icon-class="message" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            消息
          </div>
          <count-to :start-val="0" :end-val="0" :duration="3000"
                    class="card-panel-num" />
        </div>
      </div>
    </el-col>-->
    <!--<el-col :xs="7" :sm="7" :lg="7" class="card-panel-col">
      <div class="card-panel" @click="handleSetLineChartData('purchases')">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="money" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            金额
          </div>
          <count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" />
        </div>
      </div>
    </el-col>-->
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
import { getTypeGraphInfo, getBusinessInfo, getDisQuesInfo, getAnalysisInfo, getLocationGraphInfo, getLocationFinishGraphInfo } from "@/api/index";


export default {
  components: {
    CountTo
  },
  data(){
    return {
      todayQuestionCount:0,
      waitQuestionCount:0,
      totalQuestionCount:0,
      finishQuestionCount:0,
      yesterdayQuestionCount:0,
      todayDisputeCount:0,
      waitDisputeCount:0,
      totalDisputeCount:0,
      finishDisputeCount:0,
      yesterdayDisputeCount:0,
      sbdclCount:0,
      sbdclZzl:0,
      zxdclCount:0,
      zxdclZzl:0,
      dfpCount:0,
      dfpZzl:0,
      dfPZcount:0,
      disputePercent:0,
      questionPercent:0,
      totalWaitNumer:0


    }
  },
  created(){
    this.getAnalysis();
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    /** 获取咨询故障统计数量数据 */
    getAnalysis() {
      this.loading = true;
      getAnalysisInfo().then(res => {
         if(res.code == 200){
          let resData = res.data;
          this.disputePercent=resData.disputePercent;
          this.questionPercent=resData.questionPercent;
          this.todayQuestionCount = resData.todayQuestionCount;
          this.waitQuestionCount = resData.waitQuestionCount;
          this.totalQuestionCount = resData.totalQuestionCount;
          this.finishQuestionCount = resData.finishQuestionCount;
          this.yesterdayQuestionCount = resData.yesterdayQuestionCount;
          this.todayDisputeCount = resData.todayDisputeCount;
          this.waitDisputeCount = resData.waitDisputeCount;
          this.totalDisputeCount = resData.totalDisputeCount;
          this.finishDisputeCount = resData.finishDisputeCount;
          this.yesterdayDisputeCount = resData.yesterdayDisputeCount;
          this.sbdclCount=this.todayDisputeCount - this.yesterdayDisputeCount;
          this.totalWaitNumer=this.waitQuestionCount+this.waitDisputeCount;
          if(this.todayDisputeCount !=0){
            const _sbdclZzl = parseFloat((this.todayDisputeCount/this.yesterdayDisputeCount-1)).toFixed(2);
            this.sbdclZzl = _sbdclZzl*100;
          }
          this.zxdclCount = this.todayQuestionCount - this.yesterdayQuestionCount;

          if(this.todayQuestionCount !=0){
            const _zxdclZzl = parseFloat((this.todayQuestionCount/this.yesterdayQuestionCount-1)).toFixed(2);
            this.zxdclZzl = _zxdclZzl*100;
          }
          this.dfpCount = this.todayQuestionCount+this.todayDisputeCount;
          const _zr = this.yesterdayDisputeCount+this.yesterdayQuestionCount;
          if(this.dfpCount !=0){
             const _dfpZzl =parseFloat((this.dfpCount/_zr-1)).toFixed(2);
             this.dfpZzl = _dfpZzl*100;
          }
          this.dfPZcount = this.finishQuestionCount+ this.finishDisputeCount;

        }
      });
    },
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;
  width:100%;
  //display: flex;
  //justify-content: space-between;
  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 120px;
    cursor: pointer;
    font-size: 12px;
    //position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
		border-radius: 5px;
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
